﻿Public Class ven_analcargas_graf


    Private Sub btn_graficarmfyz_restt_Click(sender As Object, e As EventArgs) Handles btn_graficarmfyz_restt.Click
        Dim y = 0 'variable independiente, refiere a la posicion longitudinal

        If esa = 1 And ecvd = 0 And ecvi = 0 And ecdv = 0 Then ' árbol simplemente apoyado
            If yc1 > 0 And yc2 = 0 Then 'caso con una carga en el vano
                For y = 0 To yc1
                    Chart_mfyz_restt.Series("region1").Points.AddXY(y, r1z * y)
                Next
                For y = yc1 To yt
                    Chart_mfyz_restt.Series("region2").Points.AddXY(y, r1z * y + c1z * (y - yc1) - m1x)
                Next
            End If
            If yc1 > 0 And yc2 > 0 Then 'caso con dos cargas en el vano
                For y = 0 To yc1
                    Chart_mfyz_restt.Series("region1").Points.AddXY(y, r1z * y)
                Next
                For y = yc1 To yc2
                    Chart_mfyz_restt.Series("region2").Points.AddXY(y, r1z * y + c1z * (y - yc1) - m1x)
                Next
                For y = yc2 To yt
                    Chart_mfyz_restt.Series("region3").Points.AddXY(y, r1z * y + (c1z * (y - yc1) + c2z * (y - yc2)) - (m1x + m2x))
                Next
            End If
        End If

        If ecvd = 1 And esa = 0 And ecvi = 0 And ecdv = 0 Then 'tipologia de árbol con voladizo derecho
            If yc1 > 0 And yc2 = 0 And yc3 > 0 And yc4 = 0 Then 'caso con una carga en cada vano
                For y = 0 To yc1
                    Chart_mfyz_restt.Series("region1").Points.AddXY(y, r1z * y)
                Next
                For y = yc1 To yr2
                    Chart_mfyz_restt.Series("region2").Points.AddXY(y, r1z * y + c1z * (y - yc1) - m1x)
                Next
                For y = yr2 To yc3
                    Chart_mfyz_restt.Series("region3").Points.AddXY(y, r1z * y + r2z * (y - yr2) + (c1z * (y - yc1)) - (m1x))
                Next
                For y = yc3 To yt
                    Chart_mfyz_restt.Series("region4").Points.AddXY(y, r1z * y + r2z * (y - yr2) + (c1z * (y - yc1) + c3z * (y - yc3)) - (m1x + m3x))
                Next
            End If
            If yc1 > 0 And yc2 > 0 And yc3 > 0 And yc4 = 0 Then 'caso con dos cargas en primer vano y una carga en el segundo vano
                For y = 0 To yc1
                    Chart_mfyz_restt.Series("region1").Points.AddXY(y, r1z * y)
                Next
                For y = yc1 To yc2
                    Chart_mfyz_restt.Series("region2").Points.AddXY(y, r1z * y + c1z * (y - yc1) - m1x)
                Next
                For y = yc2 To yr2
                    Chart_mfyz_restt.Series("region3").Points.AddXY(y, r1z * y + (c1z * (y - yc1) + c2z * (y - yc2)) - (m1x + m2x))
                Next
                For y = yr2 To yc3
                    Chart_mfyz_restt.Series("region4").Points.AddXY(y, r1z * y + r2z * (y - yr2) + (c1z * (y - yc1) + c2z * (y - yc2)) - (m1x + m2x))
                Next
                For y = yc3 To yt
                    Chart_mfyz_restt.Series("region5").Points.AddXY(y, r1z * y + r2z * (y - yr2) + (c1z * (y - yc1) + c2z * (y - yc2) + c3z * (y - yc3)) - (m1x + m2x + m3x))
                Next
            End If
            If yc1 > 0 And yc2 = 0 And yc3 > 0 And yc4 > 0 Then 'caso con una carga en el primer vano y dos cargas en segundo vano
                For y = 0 To yc1
                    Chart_mfyz_restt.Series("region1").Points.AddXY(y, r1z * y)
                Next
                For y = yc1 To yr2
                    Chart_mfyz_restt.Series("region2").Points.AddXY(y, r1z * y + c1z * (y - yc1) - m1x)
                Next
                For y = yr2 To yc3
                    Chart_mfyz_restt.Series("region3").Points.AddXY(y, r1z * y + r2z * (y - yr2) + (c1z * (y - yc1)) - (m1x))
                Next
                For y = yc3 To yc4
                    Chart_mfyz_restt.Series("region4").Points.AddXY(y, r1z * y + r2z * (y - yr2) + (c1z * (y - yc1) + c3z * (y - yc3)) - (m1x + m3x))
                Next
                For y = yc4 To yt
                    Chart_mfyz_restt.Series("region5").Points.AddXY(y, r1z * y + r2z * (y - yr2) + (c1z * (y - yc1) + c3z * (y - yc3) + c4z * (y - yc4)) - (m1x + m3x + m4x))
                Next
            End If
            If yc1 > 0 And yc2 > 0 And yc3 > 0 And yc4 > 0 Then 'caso con dos cargas en cada vano
                For y = 0 To yc1
                    Chart_mfyz_restt.Series("region1").Points.AddXY(y, r1z * y)
                Next
                For y = yc1 To yc2
                    Chart_mfyz_restt.Series("region2").Points.AddXY(y, r1z * y + c1z * (y - yc1) - m1x)
                Next
                For y = yc2 To yr2
                    Chart_mfyz_restt.Series("region3").Points.AddXY(y, r1z * y + (c1z * (y - yc1) + c2z * (y - yc2)) - (m1x + m2x))
                Next
                For y = yr2 To yc3
                    Chart_mfyz_restt.Series("region4").Points.AddXY(y, r1z * y + r2z * (y - yr2) + (c1z * (y - yc1) + c2z * (y - yc2)) - (m1x + m2x))
                Next
                For y = yc3 To yc4
                    Chart_mfyz_restt.Series("region5").Points.AddXY(y, r1z * y + r2z * (y - yr2) + (c1z * (y - yc1) + c2z * (y - yc2) + c3z * (y - yc3)) - (m1x + m2x + m3x))
                Next
                For y = yc4 To yt
                    Chart_mfyz_restt.Series("region6").Points.AddXY(y, r1z * y + r2z * (y - yr2) + (c1z * (y - yc1) + c2z * (y - yc2) + c3z * (y - yc3) + c4z * (y - yc4)) - (m1x + m2x + m3x + m4x))
                Next
            End If
        End If

        If ecvi = 1 And esa = 0 And ecvd = 0 And ecdv = 0 Then 'tipologia con voladizo izquierdo AQUI NOS QUEDAMOS FALTA EMPEZAR !!!
            If yc1 > 0 And yc2 = 0 And yc3 > 0 And yc4 = 0 Then 'con una carga en cada vano
                For y = 0 To yc1
                    Chart_mfyz_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yc1 To yr1
                    Chart_mfyz_restt.Series("region2").Points.AddXY(y, c1z * (y - yc1) - m1x)
                Next
                For y = yr1 To yc3
                    Chart_mfyz_restt.Series("region3").Points.AddXY(y, r1z * (y - yr1) + (c1z * (y - yc1)) - (m1x))
                Next
                For y = yc3 To yt
                    Chart_mfyz_restt.Series("region4").Points.AddXY(y, r1z * (y - yr1) + (c1z * (y - yc1) + c3z * (y - yc3)) - (m1x + m3x))
                Next
            End If
            If yc1 > 0 And yc2 > 0 And yc3 > 0 And yc4 = 0 Then 'con dos cargas en primer vano y una carga en el segundo vano
                For y = 0 To yc1
                    Chart_mfyz_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yc1 To yc2
                    Chart_mfyz_restt.Series("region2").Points.AddXY(y, c1z * (y - yc1) - m1x)
                Next
                For y = yc2 To yr1
                    Chart_mfyz_restt.Series("region3").Points.AddXY(y, (c1z * (y - yc1) + c2z * (y - yc2)) - (m1x + m2x))
                Next
                For y = yr1 To yc3
                    Chart_mfyz_restt.Series("region4").Points.AddXY(y, r1z * (y - yr1) + (c1z * (y - yc1) + c2z * (y - yc2)) - (m1x + m2x))
                Next
                For y = yc3 To yt
                    Chart_mfyz_restt.Series("region5").Points.AddXY(y, r1z * (y - yr1) + (c1z * (y - yc1) + c2z * (y - yc2) + c3z * (y - yc3)) - (m1x + m2x + m3x))
                Next
            End If
            If yc1 > 0 And yc2 = 0 And yc3 > 0 And yc4 > 0 Then 'con una carga en primer vano y dos cargas en segundo vano
                For y = 0 To yc1
                    Chart_mfyz_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yc1 To yr1
                    Chart_mfyz_restt.Series("region2").Points.AddXY(y, c1z * (y - yc1) - m1x)
                Next
                For y = yr1 To yc3
                    Chart_mfyz_restt.Series("region3").Points.AddXY(y, (c1z * (y - yc1)) - (m1x) + r1z * (y - yr1))
                Next
                For y = yc3 To yc4
                    Chart_mfyz_restt.Series("region4").Points.AddXY(y, r1z * (y - yr1) + (c1z * (y - yc1) + c3z * (y - yc3)) - (m1x + m3x))
                Next
                For y = yc4 To yt
                    Chart_mfyz_restt.Series("region5").Points.AddXY(y, r1z * (y - yr1) + (c1z * (y - yc1) + c3z * (y - yc3) + c4z * (y - yc4)) - (m1x + m3x + m4x))
                Next
            End If
            If yc1 > 0 And yc2 > 0 And yc3 > 0 And yc4 > 0 Then 'con dos cargas en cada vano
                For y = 0 To yc1
                    Chart_mfyz_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yc1 To yc2
                    Chart_mfyz_restt.Series("region2").Points.AddXY(y, c1z * (y - yc1) - m1x)
                Next
                For y = yc2 To yr1
                    Chart_mfyz_restt.Series("region3").Points.AddXY(y, (c1z * (y - yc1) + c2z * (y - yc2)) - (m1x + m2x))
                Next
                For y = yr1 To yc3
                    Chart_mfyz_restt.Series("region4").Points.AddXY(y, r1z * (y - yr1) + (c1z * (y - yc1) + c2z * (y - yc2)) - (m1x + m2x))
                Next
                For y = yc3 To yc4
                    Chart_mfyz_restt.Series("region5").Points.AddXY(y, r1z * (y - yr1) + (c1z * (y - yc1) + c2z * (y - yc2) + c3z * (y - yc3)) - (m1x + m2x + m3x))
                Next
                For y = yc4 To yt
                    Chart_mfyz_restt.Series("region6").Points.AddXY(y, r1z * (y - yr1) + (c1z * (y - yc1) + c2z * (y - yc2) + c3z * (y - yc3) + c4z * (y - yc4)) - (m1x + m2x + m3x + m4x))
                Next
            End If
        End If

        If ecdv = 1 And ecvi = 0 And esa = 0 And ecvd = 0 Then 'tipologia de arbol con dos voladizos
            If yc1 > 0 And yc2 = 0 And yc3 > 0 And yc4 = 0 And yc5 > 0 And yc6 = 0 Then 'caso con una carga en cada vano
                For y = 0 To yc1
                    Chart_mfyz_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yc1 To yr1
                    Chart_mfyz_restt.Series("region2").Points.AddXY(y, c1z * (y - yc1) - m1x)
                Next
                For y = yr1 To yc3
                    Chart_mfyz_restt.Series("region3").Points.AddXY(y, c1z * (y - yc1) + r1z * (y - yr1) - m1x)
                Next
                For y = yc3 To yr2
                    Chart_mfyz_restt.Series("region4").Points.AddXY(y, c1z * (y - yc1) + c3z * (y - yc3) + r1z * (y - yr1) - m1x - m3x)
                Next
                For y = yr2 To yc5
                    Chart_mfyz_restt.Series("region5").Points.AddXY(y, c1z * (y - yc1) + c3z * (y - yc3) + r1z * (y - yr1) + r2z * (y - yr2) - m1x - m3x)
                Next
                For y = yc5 To yt
                    Chart_mfyz_restt.Series("region6").Points.AddXY(y, c1z * (y - yc1) + c3z * (y - yc3) + c5z * (y - yc5) + r1z * (y - yr1) + r2z * (y - yr2) - m1x - m3x - m5x)
                Next
            End If
            If yc1 > 0 And yc2 = 0 And yc3 > 0 And yc4 = 0 And yc5 = 0 And yc6 = 0 Then 'caso con una carga en primer vano y una carga en segundo vano y sin carga en tercer vano
                For y = 0 To yc1
                    Chart_mfyz_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yc1 To yr1
                    Chart_mfyz_restt.Series("region2").Points.AddXY(y, c1z * (y - yc1) - m1x)
                Next
                For y = yr1 To yc3
                    Chart_mfyz_restt.Series("region3").Points.AddXY(y, c1z * (y - yc1) + r1z * (y - yr1) - m1x)
                Next
                For y = yc3 To yr2
                    Chart_mfyz_restt.Series("region4").Points.AddXY(y, c1z * (y - yc1) + c3z * (y - yc3) + r1z * (y - yr1) - m1x - m3x)
                Next
                For y = yr2 To yt
                    Chart_mfyz_restt.Series("region5").Points.AddXY(y, c1z * (y - yc1) + c3z * (y - yc3) + r1z * (y - yr1) + r2z * (y - yr2) - m1x - m3x)
                Next
            End If
            If yc1 = 0 And yc2 = 0 And yc3 > 0 And yc4 = 0 And yc5 > 0 And yc6 = 0 Then 'caso una carga en segundo vano y una en tercer vano
                For y = 0 To yr1
                    Chart_mfyz_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yr1 To yc3
                    Chart_mfyz_restt.Series("region2").Points.AddXY(y, r1z * (y - yr1))
                Next
                For y = yc3 To yr2
                    Chart_mfyz_restt.Series("region3").Points.AddXY(y, c3z * (y - yc3) + r1z * (y - yr1) - m3x)
                Next
                For y = yr2 To yc5
                    Chart_mfyz_restt.Series("region4").Points.AddXY(y, c3z * (y - yc3) + r1z * (y - yr1) + r2z * (y - yr2) - m3x)
                Next
                For y = yc5 To yt
                    Chart_mfyz_restt.Series("region5").Points.AddXY(y, c3z * (y - yc3) + c5z * (y - yc5) + r1z * (y - yr1) + r2z * (y - yr2) - m3x - m5x)
                Next
            End If
            

        End If

    End Sub

    Private Sub btn_graficarmfyx_restt_Click(sender As Object, e As EventArgs) Handles btn_graficarmfyx_restt.Click
        Dim y = 0 'variable independiente, refiere a la posicion longitudinal

        If esa = 1 And ecvd = 0 And ecvi = 0 And ecdv = 0 Then 'tipologia de árbol simplemente apoyado
            If yc1 > 0 And yc2 = 0 Then 'caso con una carga en el vano
                For y = 0 To yc1
                    Chart_mfyx_restt.Series("region1").Points.AddXY(y, r1x * y)
                Next
                For y = yc1 To yt
                    Chart_mfyx_restt.Series("region2").Points.AddXY(y, r1x * y + c1x * (y - yc1) + m1z)
                Next
            End If
            If yc1 > 0 And yc2 > 0 Then 'caso con dos cargas en el vano
                For y = 0 To yc1
                    Chart_mfyx_restt.Series("region1").Points.AddXY(y, r1x * y)
                Next
                For y = yc1 To yc2
                    Chart_mfyx_restt.Series("region2").Points.AddXY(y, r1x * y + c1x * (y - yc1) + m1z)
                Next
                For y = yc2 To yt
                    Chart_mfyx_restt.Series("region3").Points.AddXY(y, r1x * y + (c1x * (y - yc1) + c2x * (y - yc2)) + (m1z + m2z))
                Next
            End If
        End If

        If ecvd = 1 And esa = 0 And ecvi = 0 And ecdv = 0 Then 'tipologia de árbol con voladizo derecho
            If yc1 > 0 And yc2 = 0 And yc3 > 0 And yc4 = 0 Then 'caso con una carga en cada vano
                For y = 0 To yc1
                    Chart_mfyx_restt.Series("region1").Points.AddXY(y, r1x * y)
                Next
                For y = yc1 To yr2
                    Chart_mfyx_restt.Series("region2").Points.AddXY(y, r1x * y + c1x * (y - yc1) + m1z)
                Next
                For y = yr2 To yc3
                    Chart_mfyx_restt.Series("region3").Points.AddXY(y, r1x * y + r2x * (y - yr2) + (c1x * (y - yc1)) + (m1z))
                Next
                For y = yc3 To yt
                    Chart_mfyx_restt.Series("region4").Points.AddXY(y, r1x * y + r2x * (y - yr2) + (c1x * (y - yc1) + c3x * (y - yc3)) + (m1z + m3z))
                Next
            End If
            If yc1 > 0 And yc2 > 0 And yc3 > 0 And yc4 = 0 Then 'caso con dos cargas en primer vano y una carga en el segundo vano
                For y = 0 To yc1
                    Chart_mfyx_restt.Series("region1").Points.AddXY(y, r1x * y)
                Next
                For y = yc1 To yc2
                    Chart_mfyx_restt.Series("region2").Points.AddXY(y, r1x * y + c1x * (y - yc1) + m1z)
                Next
                For y = yc2 To yr2
                    Chart_mfyx_restt.Series("region3").Points.AddXY(y, r1x * y + (c1x * (y - yc1) + c2x * (y - yc2)) + (m1z + m2z))
                Next
                For y = yr2 To yc3
                    Chart_mfyx_restt.Series("region4").Points.AddXY(y, r1x * y + r2x * (y - yr2) + (c1x * (y - yc1) + c2x * (y - yc2)) + (m1z + m2z))
                Next
                For y = yc3 To yt
                    Chart_mfyx_restt.Series("region5").Points.AddXY(y, r1x * y + r2x * (y - yr2) + (c1x * (y - yc1) + c2x * (y - yc2) + c3x * (y - yc3)) + (m1z + m2z + m3z))
                Next
            End If
            If yc1 > 0 And yc2 = 0 And yc3 > 0 And yc4 > 0 Then 'caso con una carga en el primer vano y dos cargas en segundo vano
                For y = 0 To yc1
                    Chart_mfyx_restt.Series("region1").Points.AddXY(y, r1x * y)
                Next
                For y = yc1 To yr2
                    Chart_mfyx_restt.Series("region2").Points.AddXY(y, r1x * y + c1x * (y - yc1) + m1z)
                Next
                For y = yr2 To yc3
                    Chart_mfyx_restt.Series("region3").Points.AddXY(y, r1x * y + r2x * (y - yr2) + (c1x * (y - yc1)) + (m1z))
                Next
                For y = yc3 To yc4
                    Chart_mfyx_restt.Series("region4").Points.AddXY(y, r1x * y + r2x * (y - yr2) + (c1x * (y - yc1) + c3x * (y - yc3)) + (m1z + m3z))
                Next
                For y = yc4 To yt
                    Chart_mfyx_restt.Series("region5").Points.AddXY(y, r1x * y + r2x * (y - yr2) + (c1x * (y - yc1) + c3x * (y - yc3) + c4x * (y - yc4)) + (m1z + m3z + m4z))
                Next
            End If
            If yc1 > 0 And yc2 > 0 And yc3 > 0 And yc4 > 0 Then 'caso con dos cargas en cada vano
                For y = 0 To yc1
                    Chart_mfyx_restt.Series("region1").Points.AddXY(y, r1x * y)
                Next
                For y = yc1 To yc2
                    Chart_mfyx_restt.Series("region2").Points.AddXY(y, r1x * y + c1x * (y - yc1) + m1z)
                Next
                For y = yc2 To yr2
                    Chart_mfyx_restt.Series("region3").Points.AddXY(y, r1x * y + (c1x * (y - yc1) + c2x * (y - yc2)) + (m1z + m2z))
                Next
                For y = yr2 To yc3
                    Chart_mfyx_restt.Series("region4").Points.AddXY(y, r1x * y + r2x * (y - yr2) + (c1x * (y - yc1) + c2x * (y - yc2)) + (m1z + m2z))
                Next
                For y = yc3 To yc4
                    Chart_mfyx_restt.Series("region5").Points.AddXY(y, r1x * y + r2x * (y - yr2) + (c1x * (y - yc1) + c2x * (y - yc2) + c3x * (y - yc3)) + (m1z + m2z + m3z))
                Next
                For y = yc4 To yt
                    Chart_mfyx_restt.Series("region6").Points.AddXY(y, r1x * y + r2x * (y - yr2) + (c1x * (y - yc1) + c2x * (y - yc2) + c3x * (y - yc3) + c4x * (y - yc4)) + (m1z + m2z + m3z + m4z))
                Next
            End If
        End If

        If ecvi = 1 And esa = 0 And ecvd = 0 And ecdv = 0 Then 'tipologia con voladizo izquierdo ' tamos aca!!!
            If yc1 > 0 And yc2 = 0 And yc3 > 0 And yc4 = 0 Then 'con una carga en cada vano
                For y = 0 To yc1
                    Chart_mfyx_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yc1 To yr1
                    Chart_mfyx_restt.Series("region2").Points.AddXY(y, c1x * (y - yc1) + m1z)
                Next
                For y = yr1 To yc3
                    Chart_mfyx_restt.Series("region3").Points.AddXY(y, r1x * (y - yr1) + (c1x * (y - yc1)) + (m1z))
                Next
                For y = yc3 To yt
                    Chart_mfyx_restt.Series("region4").Points.AddXY(y, r1x * (y - yr1) + (c1x * (y - yc1) + c3x * (y - yc3)) + (m1z + m3z))
                Next
            End If
            If yc1 > 0 And yc2 > 0 And yc3 > 0 And yc4 = 0 Then 'con dos cargas en primer vano y una carga en el segundo vano
                For y = 0 To yc1
                    Chart_mfyx_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yc1 To yc2
                    Chart_mfyx_restt.Series("region2").Points.AddXY(y, c1x * (y - yc1) + m1z)
                Next
                For y = yc2 To yr1
                    Chart_mfyx_restt.Series("region3").Points.AddXY(y, (c1x * (y - yc1) + c2x * (y - yc2)) + (m1z + m2z))
                Next
                For y = yr1 To yc3
                    Chart_mfyx_restt.Series("region4").Points.AddXY(y, r1x * (y - yr1) + (c1x * (y - yc1) + c2x * (y - yc2)) + (m1z + m2z))
                Next
                For y = yc3 To yt
                    Chart_mfyx_restt.Series("region5").Points.AddXY(y, r1x * (y - yr1) + (c1x * (y - yc1) + c2x * (y - yc2) + c3x * (y - yc3)) + (m1z + m2z + m3z))
                Next
            End If
            If yc1 > 0 And yc2 = 0 And yc3 > 0 And yc4 > 0 Then 'con una carga en primer vano y dos cargas en segundo vano
                For y = 0 To yc1
                    Chart_mfyx_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yc1 To yr1
                    Chart_mfyx_restt.Series("region2").Points.AddXY(y, c1x * (y - yc1) + m1z)
                Next
                For y = yr1 To yc3
                    Chart_mfyx_restt.Series("region3").Points.AddXY(y, c1x * (y - yc1) + m1z + r1x * (y - yr1))
                Next
                For y = yc3 To yc4
                    Chart_mfyx_restt.Series("region4").Points.AddXY(y, r1x * (y - yr1) + (c1x * (y - yc1) + c3x * (y - yc3)) + (m1z + m3z))
                Next
                For y = yc4 To yt
                    Chart_mfyx_restt.Series("region5").Points.AddXY(y, r1x * (y - yr1) + (c1x * (y - yc1) + c3x * (y - yc3) + c4x * (y - yc4)) + (m1z + m3z + m4z))
                Next
            End If
            If yc1 > 0 And yc2 > 0 And yc3 > 0 And yc4 > 0 Then 'con dos cargas en cada vano
                For y = 0 To yc1
                    Chart_mfyx_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yc1 To yc2
                    Chart_mfyx_restt.Series("region2").Points.AddXY(y, c1x * (y - yc1) + m1z)
                Next
                For y = yc2 To yr1
                    Chart_mfyx_restt.Series("region3").Points.AddXY(y, (c1x * (y - yc1) + c2x * (y - yc2)) + (m1z + m2z))
                Next
                For y = yr1 To yc3
                    Chart_mfyx_restt.Series("region4").Points.AddXY(y, r1x * (y - yr1) + (c1x * (y - yc1) + c2x * (y - yc2)) + (m1z + m2z))
                Next
                For y = yc3 To yc4
                    Chart_mfyx_restt.Series("region5").Points.AddXY(y, r1x * (y - yr1) + (c1x * (y - yc1) + c2x * (y - yc2) + c3x * (y - yc3)) + (m1z + m2z + m3z))
                Next
                For y = yc4 To yt
                    Chart_mfyx_restt.Series("region6").Points.AddXY(y, r1x * (y - yr1) + (c1x * (y - yc1) + c2x * (y - yc2) + c3x * (y - yc3) + c4x * (y - yc4)) + (m1z + m2z + m3z + m4z))
                Next
            End If
        End If

        If ecdv = 1 And ecvi = 0 And esa = 0 And ecvd = 0 Then 'tipologia de arbol con dos voladizos
            If yc1 > 0 And yc2 = 0 And yc3 > 0 And yc4 = 0 And yc5 > 0 And yc6 = 0 Then 'caso con una carga en cada vano
                For y = 0 To yc1
                    Chart_mfyx_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yc1 To yr1
                    Chart_mfyx_restt.Series("region2").Points.AddXY(y, c1x * (y - yc1) + m1z)
                Next
                For y = yr1 To yc3
                    Chart_mfyx_restt.Series("region3").Points.AddXY(y, c1x * (y - yc1) + r1x * (y - yr1) + m1z)
                Next
                For y = yc3 To yr2
                    Chart_mfyx_restt.Series("region4").Points.AddXY(y, c1x * (y - yc1) + c3x * (y - yc3) + r1x * (y - yr1) + m1z + m3z)
                Next
                For y = yr2 To yc5
                    Chart_mfyx_restt.Series("region5").Points.AddXY(y, c1x * (y - yc1) + c3x * (y - yc3) + r1x * (y - yr1) + r2x * (y - yr2) + m1z + m3z)
                Next
                For y = yc5 To yt
                    Chart_mfyx_restt.Series("region6").Points.AddXY(y, c1x * (y - yc1) + c3x * (y - yc3) + c5x * (y - yc5) + r1x * (y - yr1) + r2x * (y - yr2) + m1z + m3z + m5z)
                Next
            End If
            If yc1 > 0 And yc2 = 0 And yc3 > 0 And yc4 = 0 And yc5 = 0 And yc6 = 0 Then 'caso con una carga en primer vano y una carga en segundo vano y sin carga en tercer vano
                For y = 0 To yc1
                    Chart_mfyx_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yc1 To yr1
                    Chart_mfyx_restt.Series("region2").Points.AddXY(y, c1x * (y - yc1) + m1z)
                Next
                For y = yr1 To yc3
                    Chart_mfyx_restt.Series("region3").Points.AddXY(y, c1x * (y - yc1) + r1x * (y - yr1) + m1z)
                Next
                For y = yc3 To yr2
                    Chart_mfyx_restt.Series("region4").Points.AddXY(y, c1x * (y - yc1) + c3x * (y - yc3) + r1x * (y - yr1) + m1z + m3z)
                Next
                For y = yr2 To yt
                    Chart_mfyx_restt.Series("region5").Points.AddXY(y, c1x * (y - yc1) + c3x * (y - yc3) + r1x * (y - yr1) + r2x * (y - yr2) + m1z + m3z)
                Next
            End If
            If yc1 = 0 And yc2 = 0 And yc3 > 0 And yc4 = 0 And yc5 > 0 And yc6 = 0 Then 'caso una carga en segundo vano y una en tercer vano
                For y = 0 To yr1
                    Chart_mfyx_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yr1 To yc3
                    Chart_mfyx_restt.Series("region2").Points.AddXY(y, r1x * (y - yr1))
                Next
                For y = yc3 To yr2
                    Chart_mfyx_restt.Series("region3").Points.AddXY(y, c3x * (y - yc3) + r1x * (y - yr1) + m3z)
                Next
                For y = yr2 To yc5
                    Chart_mfyx_restt.Series("region4").Points.AddXY(y, c3x * (y - yc3) + r1x * (y - yr1) + r2x * (y - yr2) + m3z)
                Next
                For y = yc5 To yt
                    Chart_mfyx_restt.Series("region5").Points.AddXY(y, c3x * (y - yc3) + c5x * (y - yc5) + r1x * (y - yr1) + r2x * (y - yr2) + m3z + m5z)
                Next
            End If


        End If


    End Sub

    Private Sub btn_graficarmt_restt_Click(sender As Object, e As EventArgs) Handles btn_graficarmt_restt.Click
        Dim y = 0 'variable independiente, refiere a la posicion longitudinal

        If esa = 1 And ecvd = 0 And ecvi = 0 And ecdv = 0 Then 'tipologia de árbol simplemente apoyado
            If yc1 > 0 And yc2 = 0 Then 'caso con una carga en el vano
                For y = 0 To yc1
                    Chart_mt_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yc1 To yt
                    Chart_mt_restt.Series("region2").Points.AddXY(y, -m1y)
                Next
            End If
            If yc1 > 0 And yc2 > 0 Then 'caso con dos cargas en el vano
                For y = 0 To yc1
                    Chart_mt_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yc1 To yc2
                    Chart_mt_restt.Series("region2").Points.AddXY(y, -m1y)
                Next
                For y = yc2 To yt
                    Chart_mt_restt.Series("region3").Points.AddXY(y, -m1y - m2y)
                Next
            End If
        End If

        If ecvd = 1 And esa = 0 And ecvi = 0 And ecdv = 0 Then 'tipologia de árbol con voladizo derecho
            If yc1 > 0 And yc2 = 0 And yc3 > 0 And yc4 = 0 Then 'caso con una carga en cada vano
                For y = 0 To yc1
                    Chart_mt_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yc1 To yr2
                    Chart_mt_restt.Series("region2").Points.AddXY(y, -m1y)
                Next
                For y = yr2 To yc3
                    Chart_mt_restt.Series("region3").Points.AddXY(y, -m1y)
                Next
                For y = yc3 To yt
                    Chart_mt_restt.Series("region4").Points.AddXY(y, -(m1y + m3y))
                Next
            End If
            If yc1 > 0 And yc2 > 0 And yc3 > 0 And yc4 = 0 Then 'caso con dos cargas en primer vano y una carga en el segundo vano
                For y = 0 To yc1
                    Chart_mt_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yc1 To yc2
                    Chart_mt_restt.Series("region2").Points.AddXY(y, -m1y)
                Next
                For y = yc2 To yr2
                    Chart_mt_restt.Series("region3").Points.AddXY(y, -m1y - m2y)
                Next
                For y = yr2 To yc3
                    Chart_mt_restt.Series("region4").Points.AddXY(y, -m1y - m2y)
                Next
                For y = yc3 To yt
                    Chart_mt_restt.Series("region5").Points.AddXY(y, -(m1y + m2y + m3y))
                Next
            End If
            If yc1 > 0 And yc2 = 0 And yc3 > 0 And yc4 > 0 Then 'caso con una carga en el primer vano y dos cargas en segundo vano
                For y = 0 To yc1
                    Chart_mt_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yc1 To yr2
                    Chart_mt_restt.Series("region2").Points.AddXY(y, -m1y)
                Next
                For y = yr2 To yc3
                    Chart_mt_restt.Series("region3").Points.AddXY(y, -m1y)
                Next
                For y = yc3 To yc4
                    Chart_mt_restt.Series("region4").Points.AddXY(y, -(m1y + m3y))
                Next
                For y = yc4 To yt
                    Chart_mt_restt.Series("region5").Points.AddXY(y, -(m1y + m3y + m4y))
                Next
            End If
            If yc1 > 0 And yc2 > 0 And yc3 > 0 And yc4 > 0 Then 'caso con dos cargas en cada vano
                For y = 0 To yc1
                    Chart_mt_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yc1 To yc2
                    Chart_mt_restt.Series("region2").Points.AddXY(y, -m1y)
                Next
                For y = yc2 To yr2
                    Chart_mt_restt.Series("region3").Points.AddXY(y, -m1y - m2y)
                Next
                For y = yr2 To yc3
                    Chart_mt_restt.Series("region4").Points.AddXY(y, -m1y - m2y)
                Next
                For y = yc3 To yc4
                    Chart_mt_restt.Series("region5").Points.AddXY(y, -(m1y + m2y + m3y))
                Next
                For y = yc4 To yt
                    Chart_mt_restt.Series("region6").Points.AddXY(y, -(m1y + m2y + m3y + m4y))
                Next
            End If
        End If

        If ecvi = 1 And esa = 0 And ecvd = 0 And ecdv = 0 Then 'tipologia con voladizo izquierdo
            If yc1 > 0 And yc2 = 0 And yc3 > 0 And yc4 = 0 Then 'con una carga en cada vano
                For y = 0 To yc1
                    Chart_mt_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yc1 To yr1
                    Chart_mt_restt.Series("region2").Points.AddXY(y, -m1y)
                Next
                For y = yr1 To yc3
                    Chart_mt_restt.Series("region3").Points.AddXY(y, -m1y)
                Next
                For y = yc3 To yt
                    Chart_mt_restt.Series("region4").Points.AddXY(y, -m1y - m3y)
                Next
            End If
            If yc1 > 0 And yc2 > 0 And yc3 > 0 And yc4 = 0 Then 'con dos cargas en primer vano y una carga en el segundo vano
                For y = 0 To yc1
                    Chart_mt_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yc1 To yc2
                    Chart_mt_restt.Series("region2").Points.AddXY(y, -m1y)
                Next
                For y = yc2 To yr1
                    Chart_mt_restt.Series("region3").Points.AddXY(y, -m1y - m2y)
                Next
                For y = yr1 To yc3
                    Chart_mt_restt.Series("region4").Points.AddXY(y, -m1y - m2y)
                Next
                For y = yc3 To yt
                    Chart_mt_restt.Series("region5").Points.AddXY(y, -(m1y + m2y + m3y))
                Next
            End If
            If yc1 > 0 And yc2 = 0 And yc3 > 0 And yc4 > 0 Then 'con una carga en primer vano y dos cargas en segundo vano
                For y = 0 To yc1
                    Chart_mt_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yc1 To yr1
                    Chart_mt_restt.Series("region2").Points.AddXY(y, -m1y)
                Next
                For y = yr1 To yc3
                    Chart_mt_restt.Series("region3").Points.AddXY(y, -m1y)
                Next
                For y = yc3 To yc4
                    Chart_mt_restt.Series("region4").Points.AddXY(y, -m1y - m3y)
                Next
                For y = yc4 To yt
                    Chart_mt_restt.Series("region5").Points.AddXY(y, -(m1y + m3y + m4y))
                Next
            End If
            If yc1 > 0 And yc2 > 0 And yc3 > 0 And yc4 > 0 Then 'con dos cargas en cada vano
                For y = 0 To yc1
                    Chart_mt_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yc1 To yc2
                    Chart_mt_restt.Series("region2").Points.AddXY(y, -m1y)
                Next
                For y = yc2 To yr1
                    Chart_mt_restt.Series("region3").Points.AddXY(y, -m1y - m2y)
                Next
                For y = yr1 To yc3
                    Chart_mt_restt.Series("region4").Points.AddXY(y, -m1y - m2y)
                Next
                For y = yc3 To yc4
                    Chart_mt_restt.Series("region5").Points.AddXY(y, -(m1y + m2y + m3y))
                Next
                For y = yc4 To yt
                    Chart_mt_restt.Series("region6").Points.AddXY(y, -(m1y + m2y + m3y + m4y))
                Next
            End If
        End If

        If ecdv = 1 And ecvi = 0 And esa = 0 And ecvd = 0 Then 'tipologia de arbol con dos voladizos
            If yc1 > 0 And yc2 = 0 And yc3 > 0 And yc4 = 0 And yc5 > 0 And yc6 = 0 Then 'caso con una carga en cada vano
                For y = 0 To yc1
                    Chart_mt_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yc1 To yr1
                    Chart_mt_restt.Series("region2").Points.AddXY(y, -m1y)
                Next
                For y = yr1 To yc3
                    Chart_mt_restt.Series("region3").Points.AddXY(y, -m1y)
                Next
                For y = yc3 To yr2
                    Chart_mt_restt.Series("region4").Points.AddXY(y, -m1y - m3y)
                Next
                For y = yr2 To yc5
                    Chart_mt_restt.Series("region5").Points.AddXY(y, -m1y - m3y)
                Next
                For y = yc5 To yt
                    Chart_mt_restt.Series("region6").Points.AddXY(y, -m1y - m3y - m5y)
                Next
            End If
            If yc1 > 0 And yc2 = 0 And yc3 > 0 And yc4 = 0 And yc5 = 0 And yc6 = 0 Then 'caso con una carga en primer vano y una carga en segundo vano y sin carga en tercer vano
                For y = 0 To yc1
                    Chart_mt_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yc1 To yr1
                    Chart_mt_restt.Series("region2").Points.AddXY(y, -m1y)
                Next
                For y = yr1 To yc3
                    Chart_mt_restt.Series("region3").Points.AddXY(y, -m1y)
                Next
                For y = yc3 To yr2
                    Chart_mt_restt.Series("region4").Points.AddXY(y, -m1y - m3y)
                Next
                For y = yr2 To yt
                    Chart_mt_restt.Series("region5").Points.AddXY(y, -m1y - m3y)
                Next
            End If
            If yc1 = 0 And yc2 = 0 And yc3 > 0 And yc4 = 0 And yc5 > 0 And yc6 = 0 Then 'caso una carga en segundo vano y una en tercer vano
                For y = 0 To yr1
                    Chart_mt_restt.Series("region1").Points.AddXY(y, 0)
                Next
                For y = yr1 To yc3
                    Chart_mt_restt.Series("region2").Points.AddXY(y, 0)
                Next
                For y = yc3 To yr2
                    Chart_mt_restt.Series("region3").Points.AddXY(y, -m3y)
                Next
                For y = yr2 To yc5
                    Chart_mt_restt.Series("region4").Points.AddXY(y, -m3y)
                Next
                For y = yc5 To yt
                    Chart_mt_restt.Series("region5").Points.AddXY(y, -m1y - m5y)
                Next
            End If


        End If

    End Sub

   
    
    
    Private Sub btn_helpgraf_Click(sender As Object, e As EventArgs) Handles btn_helpgraf.Click
        ven_helpgrafic.Show()
    End Sub
End Class